MDEV-39222: Error when inserting data from seq#4897
Merged
bsrikanth-mariadb merged 1 commit intobb-12.3-MDEV-38805-dev-sprint-work-2from Apr 15, 2026
Merged
Conversation
9692a89 to
79bc8c6
Compare
Member
|
The fix is ok, but the commit comment needs improvement. Ok to push after changing. |
spetrunia
approved these changes
Apr 15, 2026
Member
spetrunia
left a comment
There was a problem hiding this comment.
Ok to push after the above is addressed.
…use errors The problem can be seen as: source /tmp/saved_optimizer_context.sql INSERT ..(or any DML); -- This causes "Failed to match the stats from replay context" warning-turned-error. The cause is that saved_optimizer_context.sql ends with: set @opt_context=...; set optimizer_replay_context='opt_context'; <query for which the context was captured> Note that optimizer_replay_context remains set and will apply for any further query. == SOLUTION == Make saved optimizer context have this as last statement: set optimizer_replay_context=NULL; If one desires to replay the context, it's still available in @opt_context.
79bc8c6 to
51da7f3
Compare
51da7f3
into
bb-12.3-MDEV-38805-dev-sprint-work-2
11 of 16 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MDEV-39222: After loading saved optimizer context, further queries cause errors
The problem can be seen as:
source /tmp/saved_optimizer_context.sql
INSERT ..(or any DML);
-- This causes "Failed to match the stats from replay context" warning-turned-error.
The cause is that saved_optimizer_context.sql ends with:
set @opt_context=...;
set optimizer_replay_context='opt_context';
Note that optimizer_replay_context remains set and will apply for any further query.
== SOLUTION ==
Make saved optimizer context have this as last statement:
set optimizer_replay_context=NULL;
If one desires to replay the context, it's still available in @opt_context.